<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title>Controlling Map Scrolling</title>
<link rel="stylesheet" href="doc.css" type="text/css" />
</head>
<body>
<div class="document">
<div class="navigation navigation-header container">
<span class="previous">Previous: <a class="reference" href="map_cell_and_tile_properties.html" title="Map, Cell and Tile Properties">Map, Cell ...</a></span><span class="next">Next: <a class="reference" href="map_queries.html" title="Map Queries">Map Queries</a></span><span class="breadcrumbs"><a class="reference" href="index.html" title="Programming Guide">Programming Guide</a> » <a class="reference" href="tiled_maps.html" title="Tiled maps">Tiled maps</a> » Controlling Map Scrolling</span></div>
<h1 class="title">Controlling Map Scrolling</h1>

<p>You have three options for map scrolling:</p>
<ol class="arabic simple">
<li>never automatically scroll the map,</li>
<li>automatically scroll the map but stop at the map edges, and</li>
<li>scroll the map an allow the edge of the map to be displayed.</li>
</ol>
<p>The first is possibly the easiest since you don't need to use a
ScrollingManager layer. You simple call map.set_view(x, y, w, h) on your
map layer giving the bottom-left corner coordinates and the dimensions
to display. This could be as simple as:</p>
<pre class="py-doctest">
map.set_view(0, 0, map.px_width, map.px_height)</pre>
<p>If you wish to have the map scroll around in response to player
movement the ScrollingManager from the cocos.scrolling module
may be used.</p>
<div class="navigation navigation-footer container">
<span class="previous">Previous: <a class="reference" href="map_cell_and_tile_properties.html" title="Map, Cell and Tile Properties">Map, Cell ...</a></span><span class="next">Next: <a class="reference" href="map_queries.html" title="Map Queries">Map Queries</a></span><span class="breadcrumbs"><a class="reference" href="index.html" title="Programming Guide">Programming Guide</a> » <a class="reference" href="tiled_maps.html" title="Tiled maps">Tiled maps</a> » Controlling Map Scrolling</span></div>
</div>
</body>
</html>
